#include <iostream>
using namespace std;

class Animal
{
public:
    Animal()
    {
        cout<<"Animal()"<<endl;
    }

    /* 虚析构函数 *///之后才能调用cat的析构函数
    virtual ~Animal()
    {
        cout<<"~Animal()"<<endl;
    }
public:
    /* 纯虚函数 */
    virtual void speak() = 0;
    virtual void run() = 0;
    // virtual void speak()
    // {
    //     cout<<"Animal::speak()"<<endl;
    // }

    // virtual void run()
    // {
    //     cout<<"Animal::run()"<<endl;
    // }
private:
    int m_age;
};

class Cat : public Animal
{
public:
    Cat()
    {
        cout<<"Cat()"<<endl;
    }
    
    ~Cat()
    {
        cout<<"~Cat()"<<endl;
    }
public:
    void speak()
    {
        cout<<"Cat::speak()"<<endl;
    }

    void run()
    {
        cout<<"Cat::run()"<<endl;
    }

private:
    int m_life;
};

class Dog : public Animal
{
public:
    Dog()
    {
        cout<<"Dog()"<<endl;
    }

    ~Dog()
    {
        cout<<"~Dog()"<<endl;
    }
public:
    void speak()
    {
        cout<<"Dog::speak()"<<endl;
    }

    void run()
    {
        cout<<"Dog::run()"<<endl;
    }

private:
    int m_wang;
};

class wolf : public Animal
{
public:
    void captureFood()
    {
        cout<<"captureFood"<<endl;
    }

private:
    int m_fur;
};

int main()
{
    /* 抽象类 */
    /* 抽象类不可以示例化对象 */
    Animal al;


    // Animal *al = new Cat;
    // delete al;          //只释放了animal

    // cout<<"sizeof:"<<sizeof(al)<<endl;
    // cout<<"hello world"<<endl;

    return 0;
}